<?php

	class MediaFolderModel extends ObjectModel
	{
		public function __construct()
		{
			parent::__construct('md_folder','fd_id');
		}
				
		public function getColumns()
		{
			return array(
				new EbTableColumn('fd_id','int',true,EB_PRIMARY_KEY,true),
				new EbTableColumn('ob_id','int'),
				new EbTableColumn('pr_id','int')
			);
		}
		
		public function getFolderPath($fo_id)
		{
			$buffer = '';
			
			while ($fo_id != 0)
			{
				$folder = $this->selectById_1($fo_id);
				$buffer = $folder->name.'/'.$buffer;
				
				$fo_id = $folder->pr_id;
			}
			
			return $buffer;			
		}
	}